package com.smartao.core.info.server;

import java.util.Properties;

/**
 * Jboss 相关容器配置，支持版本 Jboss5.1
 * @author Ricky
 */
public class Jboss extends AppServer {

	private static final String CONTAINER_PREFIX = "java:/";
	private static Properties prop = new Properties();

	static {
		prop.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
		prop.put("java.naming.provider.url", "localhost:1099");
		prop.put("java.naming.factory.url.pkgs", "org.jboss.naming");
	}

	public Jboss() {
		super(prop);
		this.serverInfo="JBOSS";
		//解决jboss下临时目录不对的问题
		System.setProperty("java.io.tmpdir", getServerTempDir());
	}

	@Override
	public String getJndiName(String jndiName) {
		return CONTAINER_PREFIX + jndiName;
	}

	@Override
	public String getTransactionManagerName() {
		return "org.hibernate.transaction.JBossTransactionManagerLookup";
	}

	@Override
	public String getServerHomeDir() {
		return System.getProperty("jboss.home.dir");
	}

	@Override
	public String getServerTempDir() {
		return System.getProperty("jboss.server.temp.dir");
	}
	
}
